﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuantitativeInvestment.Bean;
using QuantitativeInvestment.Tools;
namespace QuantitativeInvestment.Factor
{
    class MAFactor:Factor
    {
        public MAFactor()
        {
            this.name = "均线";
            Parameter p = new Parameter("天数", 30);
            this.paraList.Add(p.name, p);
        }

        public override void addFactorValue(Stock stock)
        {
            int num=Int32.Parse(this.paraList["天数"].value.ToString());
            if (!stock.factors.ContainsKey(this.name))
            {
                TaLib lib = new TaLib();
                double[] mavalues = lib.getSma(stock.factors["价格收盘价"], num); ; 
                stock.factors.Add(this.name+this.paraList["天数"].value.ToString(),mavalues );
             
            }
        }
    }

}
